package com.yf.zzmusic.utils;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;

import java.util.Collections;

/**
 * 代码生成器
 */
public class CodeGenerator {
  public static void main(String[] args) {
    generator();
  }

  private static void generator() {
    FastAutoGenerator.create("jdbc:mysql://localhost/masu_gaduation_zzmusic", "root", "root")
        .globalConfig(builder -> {
          builder.author("").fileOverride().outputDir("D:\\03_code\\02_java\\00_gaduation _project\\zz_music_springboot_v2\\src\\main\\java");
        })
        .packageConfig(builder -> {
          builder.parent("com.yf.zzmusic")
              .moduleName("")
              .entity("pojo.entity")
              .pathInfo(Collections.singletonMap(OutputFile.mapperXml, "D:\\03_code\\02_java\\00_gaduation _project\\zz_music_springboot_v2\\src\\main\\java\\com\\yf\\zzmusic\\mapper\\"));
        })
        .strategyConfig(builder -> {
          builder.entityBuilder().enableLombok();
          builder.controllerBuilder().enableHyphenStyle()  // 开启驼峰转连字符
              .enableRestStyle();
          builder.addInclude("favorite_count")
              .addTablePrefix("");
        })
        .execute();
  }
}
